<template>
	<view class="w-100 row-a-j-fc" :style="'height:' + allWindowHeight + 'px;'">
		<view class="row-ac">
			<view class="iconfont icon-gouxuan row"></view>
			<view class="font-s-5 font-w ml-2">报单成功</view>
		</view>
		<view class="mt-9 font-s-4">订单状态：{{ orderDetail.is_paid == true ? '已付款' : '未付款' }}</view>
		<view class="mt-3 font-s-4">订单金额：￥{{ orderDetail.order_amount }}</view>
		<view class="font-s-35 mt-4" style="margin-right: 100rpx;margin-left: 100rpx;">
			您已经报单成功，您需要向您的上级 <text class="font-w mx-1">{{ distributorsDetail.leader_nickname }}</text>上交{{ orderDetail.order_amount }}元货款。
		</view>
		<view class="row-ac mt-9">
			<navigator class="take-box border text-muted row" url="/pages/tabar/index" open-type="switchTab">
				首页
			</navigator>
			<navigator class="take-box border text-muted row ml-3" url="/pages/tabar/my" open-type="switchTab">
				个人中心
			</navigator>
		</view>
	</view>
</template>

<script>
	import {
		orderDetailUrl,
		distributorsDetailUrl
	} from '@/api/index.js'
	export default {
		data() {
			return {
				orderDetail:'',
				allWindowHeight:'',
				distributorsDetail:''
			}
		},
		onLoad(options) {
			this.getOrderId = options.orderId
			this.getOrderDetail()
		},
		created() {
			this.$getScreenInfo().then(res => {
				this.statusBarHeight = res.statusBarHeight + 5
				this.allWindowHeight = res.windowHeight - 220
			})
			this.getDistributorsDetail()
		},
		methods:{
			getOrderDetail() {
				this.$R.get(orderDetailUrl + this.getOrderId + '/').then(res => {
					if (res.code == 200) {
						this.orderDetail = res.data
						console.log('1111', this.orderDetail);
					}
				})
			},
			getDistributorsDetail() {
				this.$R.get(distributorsDetailUrl).then(res => {
					this.distributorsDetail = res.data
				})
			},
		}
	}
</script>

<style lang="scss">
	.icon-gouxuan{
		width: 46rpx;
		height: 46rpx;
		border-radius: 50%;
		background-color: #000;
		color: #fff;
		font-size: 36rpx;
	}
	.take-box{
		width: 260rpx;
		height: 62rpx;
	}
</style>